<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: ghp
  Date: 2022/10/11
  Time: 8:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>c_foreach3</title>
</head>
<body style="text-align: center;">
<%
    List<String> users = new ArrayList<String>();
    users.add("Tom");
    users.add("Make");
    users.add("Lina");
    pageContext.setAttribute("users",users);
%>
<table border="1">
    <tr>
        <td>序号</td>
        <td>索引</td>
        <td>是否为第一个元素</td>
        <td>是否为最后一个元素</td>
        <td>元素的值</td>
    </tr>
    <c:forEach var="name" items="${users}" varStatus="status">
        <tr>
            <td>${status.count}</td>
            <td>${status.index}</td>
            <td>${status.first}</td>
            <td>${status.last}</td>
            <td>${name}</td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
